-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NFA macro + better NFA matcher #58
Conversation
Quick benchmark:
Nim's |
Almost done. I need to implement the find version that takes O(N*M) time, and benchmark it against the new O(N^2) version. It should be faster when N > M assuming it does not add much overhead. |
benchmarks against nim-regex 0.13:
|
this sounds amazing! a few points:
|
They are. I've fixed the name.
IIRC, Araq said re is faster than nre, but I can add it, no problem.
I did set -d:danger. -d:release is only 10% slower, IIRC.
Yeah, I'm using nim's docker. I'm sure it will be added in a few days.
No, it's just an optimization that avoids recursion in the matching algorithm. |
FWIW, I came across this PR when trying to benchmark mariomka for nim. Seems like most of the discussion has already been had in #57, but I wanted to just add in the benchmarks that I measured on my machine. Code is here in case I did something wrong; I am rather new to this repo.
Also, I don't think a hybrid approach for nim-regex and PCRE would be a good idea, since the selling point of nim-regex is that it's a pure Nim implementation. |
|
I'm not buying that argument. At the end of the day, we should do what's practical and useful. Certainly This allows user code to stay identical (offering same interface) regardless of whether PCRE or other library is used (implementation detail). Very concretely, the main point of pure nim implementation is making it available on all backends/environments (eg nim vm, maybe nim js or nimscript, or in cases where PCRE is not available); but, where performance matters and PCRE is available and higher performance than the nim engine, there is no practical reason not to benefit from it (other than implementing that bridge, which should be a lot easier than making improvements on the engine itself) +1 for providing a benchmark though |
@thomastay @timotheecour good news, my regex literal optimization is 34x faster than
|
Changes:
re
(most LoC changes are because of the input text file)Needs benchmarking to check for regressions.
closes #57
closes #28